IF NOT CONNECTED("src") THEN 
   CONNECT -db mfghk -ld src -N TCP -H qadser -S mfghk.

DEFINE BUFFER d FOR qaddb.csta_hist.
DEFINE BUFFER s FOR mfghk.csta_hist.

FOR EACH d WHERE d.csta_part BEGINS "P" EXCLUSIVE-LOCK:
    FIND FIRST s WHERE s.csta_part = d.csta_part NO-LOCK NO-ERROR.
    IF AVAILABLE s THEN DO:
/*        ASSIGN d.csta_dec01 = s.csta_dec01.  */
/*        ASSIGN d.csta_dec02 = s.csta_dec02.  */
/*        ASSIGN d.csta_dec03 = s.csta_dec03.  */
        DISP d.csta_part d.csta_dec01 d.csta_dec03 s.csta_dec01 s.csta_dec03. 
    END.
END.

IF CONNECTED("src") THEN DISCONNECT VALUE("src").
